package com.ruoyi.web.controller.rest.user;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.WebUser;
import com.ruoyi.system.domain.WebUserResultFollow;
import com.ruoyi.system.service.IWebUserResultFollowService;
import com.ruoyi.system.service.IWebUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 服务预约订单Controller
 * 
 * @author wsliupan@126.com
 * @date 2021-06-23
 */
@Api(tags = "效果跟进")
@RestController
@RequestMapping("/rest/user/resultFollow")
public class _WebUserResultFollowController extends BaseController
{

//    @Autowired
//    private IWebServerOrderService webServerOrderService;
    @Autowired
    private IWebUserService iWebUserService;
    @Autowired
    private IWebUserResultFollowService iWebUserResultFollowService;

    @ApiOperation("效果跟进")
    @GetMapping("")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", required = true),
    })
    public AjaxResult list(Long userId)
    {
        WebUser userData = iWebUserService.getById(userId);
        if (userData == null) {
            return error(Constants.REQUIRED_FAILD);
        }
        List<Map<String,Object>> maps = iWebUserResultFollowService.listMaps(new QueryWrapper<WebUserResultFollow>()
                .eq("user_id",userId)
                .select("create_time","content","img1","img2")
        );

        return AjaxResult.success(maps);
    }

}
